{include file="kuerp/common/menu" /}
<style>
    #edit-form td{
        text-align: left;
    }
    .panel-body{
        background: #fff;
    }
    .explain{
        color: #b9b9b9;
    }
    #edit-form .center{
        text-align: center;
    }
    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #dadada;
    }
    .list_title{
        font-size: 18px;
        margin: 20px 0 10px 0;
        color: #00adff;
    }
    .width120{
        width: 120px;
    }
    .width70{
        width: 70px;
    }
    .layui-tab-title .layui-this {
        color: #18bc9c;
    }
    .layui-tab-title .layui-this:after {
        border: 0;
        border-bottom: solid 2px #18bc9c;
        top: -1px;
    }
    #add-form,#xcx-form{
        border: solid 1px #d7d7d7;border-top: 0;border-bottom: 0;
        position: relative;
    }
    .form-group {
        margin-left: 0!important;
        margin-right: 0!important;
        border-top: solid 1px #d7d7d7;
        border-bottom: solid 1px #d7d7d7;
    }
    .form-group input,.form-group select{
        width: 100%;height: 31px;border: 0;outline: none;
    }
    .control-label{
        background: #efefef;
        height: 31px;
        line-height: 31px;
        padding-left: 0;
        padding-top: 0!important;
        text-align: left!important;
        text-indent: 10px;
    }
    .col-xs-12{
        position: relative;
    }
    .btn-default{
        border: 0;outline: none;height: 31px;background: none;
    }
    .sub_btn{
        position: absolute;bottom:-70px;
    }
    #add-form>.form-group,#xcx-form>.form-group{
        margin-bottom: 0;margin-top: 20px;
    }
    #add-form>div:first-child,#xcx-form>div:first-child{
        margin-bottom: 0!important;
    }
    input:disabled, input[disabled]{
        color: #afafaf;
    }
    tips{
        position: absolute;
        width: 500px;
        line-height: 31px;
        right: -505px;
        color: #ff8d00;
    }

    #edit-form,#price-form,#prefix-form{
        position: relative;margin-top: 20px;
    }
    #prefix-form td{
        padding: 0!important;
        height: 30px!important;
        line-height: 30px;
        text-align: center;
    }
    .textLeft{
        text-align: left;
    }
    #prefix-form input[type='checkbox'],#edit-form input[type='checkbox']{
        width: 16px;height: 16px;margin-top: 8px;
    }
    #prefix-form button{
        margin-bottom: 20px;
    }
    #prefix-form input[type='text'],#prefix-form input[type='number']{
        width: 100%;height: 100%;border: none;outline: none;padding-left: 10px;
    }
</style>
<div class="panel panel-default panel-intro">
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">

                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">{:__('Basic Settings')}</li>
                            <li>{:__('Function Parameters')}</li>
                            <li>{:__('Price Priority')}</li>
                            <li>{:__('Document Settings')}</li>
                            <!-- <li>{:__('Mini Program Settings')}</li> -->
                        </ul>
                        <div class="layui-tab-content" style="padding-bottom: 60px;">
                            <div class="layui-tab-item layui-show">
                                <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" style="max-width: 800px;">
                                    {foreach name="sets" item="vo" key="k"}
                                    {if condition="$vo.type==1"}
                                    {if condition="$vo.name=='valuation'"}
                                     <div class="form-group">
                                        <label class="control-label col-xs-12 col-sm-4">{$vo.nickname}：</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input type="hidden" value="{$vo.id}" name="row[{$k}][id]">
                                            <select id="c-{$vo.name}" class="form-control selectpicker" name="row[{$k}][value]">
                                                <option value="1" {if condition="$vo.value==1"}selected{/if}>{:__('Moving Average')}</option>
                                                <option value="2" {if condition="$vo.value==2"}selected{/if}>{:__('First In First Out')}</option>
                                            </select>
                                        </div>
                                    </div>
                                    {else/}
                                    <div class="form-group">
                                        <label class="control-label col-xs-12 col-sm-4">{$vo.nickname}：</label>
                                        <div class="col-xs-12 col-sm-8">
                                            {if condition="$vo.is_edit<1"}<input type="hidden" value="{$vo.id}" name="row[{$k}][id]">{/if}
                                            <input id="c-{$vo.name}" class="form-control" {if condition="$vo.is_edit<1"}name="row[{$k}][value]"{else/}disabled{/if} value="{$vo.value}" type="text" placeholder="{$vo.nickname}">
                                            {if condition="!empty($vo.notice)"}<tips>{$vo.notice}</tips>{/if}
                                        </div>
                                    </div>
                                    {/if}
                                    {/if}
                                    {/foreach}
                                    <button type="button" data-id="add-form" class="sub_btn btn btn-success btn-embossed">{:__('OK')}</button>
                                </form>
                            </div>
                            <div class="layui-tab-item">
                                <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
                                    <table class="table table-striped table-bordered table-hover table-nowrap">
                                        <tr>
                                            <th>{:__('Function')}</th><th class="center">{:__('Operation')}</th><th>{:__('Description')}</th>
                                        </tr>
                                        {foreach name="sets" item="vo" key="k"}
                                        {if condition="$vo.type==2"}
                                        <tr>
                                            <td>{$vo.nickname}：</td>
                                            <td class="center">
                                                <input type="hidden" value="{$vo.id}" name="row[{$k}][id]">
                                                {if condition="!empty($vo.set)"}
                                                <input type="checkbox" name="row[{$k}][is_checked]" value="1" checked style="display: none">
                                                {php}$set = unserialize($vo['set']);$setvalue = explode(',',$vo['value']);{/php}
                                                {foreach name="set" item="vo2"}
                                                <div>
                                                    <input type="checkbox" name="row[{$k}][value][]" value="{$vo2.id}" {if condition="in_array($vo2['id'],$setvalue)"}checked{/if}>
                                                    {$vo2.name}
                                                </div>
                                                {/foreach}
                                                {else/}
                                                <input type="checkbox" id="set_{$vo.name}" name="row[{$k}][is_checked]" value="1" {if condition="$vo.is_checked==1"}checked{/if}>
                                                <input type="hidden" name="row[{$k}][value]">
                                                {/if}
                                            </td>
                                            <td class="explain">
                                                {$vo.explain}
                                                {if condition="$vo.name=='taxes'"}
                                                <input type="number" name="row[{$k}][value]" value="{$vo.value}">%
                                                {/if}
                                            </td>
                                        </tr>
                                        {/if}
                                        {/foreach}
                                    </table>
                                    <button type="button" data-id="edit-form" class="sub_btn btn btn-success btn-embossed">{:__('OK')}</button>
                                </form>
                            </div>
                            <div class="layui-tab-item" style="width: 1000px;">
                                <form id="price-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
                                    <input type="hidden" value="4" name="row[type]">
                                    <div class="list_title">{:__('Sales Documents Pricing')}</div>
                                    <table class="table table-striped table-bordered table-hover table-nowrap">
                                        <tr>
                                            <th class="center width120">{:__('Sales Price Source')}</th>
                                            <th class="center width70">{:__('Enable')}</th>
                                            <th class="center width70">{:__('Priority')}</th>
                                            <th class="center">{:__('Description')}</th>
                                        </tr>
                                        <tr>
                                            <td class="center">{:__('Sales Price Strategy')}</td>
                                            <td class="center">
                                                <span>
                                                    <input readonly id="c-price_sale-switch" name="row[switch]" type="hidden" value="1" checked="checked">
                                                    <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
                                                        <i class="fa fa-toggle-on text-success fa-2x"></i>
                                                    </a>
                                                </span>
                                            </td>
                                            <td class="center">1</td>
                                            {foreach name="sets" item="vo" key="k"}
                                            {if condition="$vo.name=='price_sale'"}
                                            <td class="center" style="text-align: left">{$vo.explain|default=''}</td>
                                            {/if}
                                            {/foreach}
                                        </tr>
                                        {foreach name="sets" item="vo" key="k"}
                                        {if condition="$vo.name=='price_sale_last'"}
                                        <tr>
                                            <td class="center">{:__('Recent Sales Price')}</td>
                                            <td class="center">
                                                <span>
                                                    <input id="c-price_sale_last" name="row[price_sale_last]" type="hidden" value="{$vo.is_checked}" {if condition="$vo.is_checked==1"}checked="checked"{/if}>
                                                    <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-price_sale_last" data-yes="1" data-no="0">
                                                        <i class="fa fa-toggle-on text-success fa-2x {if condition='$vo.is_checked!=1'}fa-flip-horizontal text-gray{/if}"></i>
                                                    </a>
                                                </span>
                                            </td>
                                            <td class="center">2</td>
                                            <td class="center" style="text-align: left">{$vo.explain|default=''}</td>
                                        </tr>
                                        {/if}
                                        {/foreach}
                                    </table>
                                    <div class="list_title">{:__('Purchase Documents Pricing')}</div>
                                    <table class="table table-striped table-bordered table-hover table-nowrap">
                                        <tr>
                                            <th class="center width120">{:__('Purchase Price Source')}</th>
                                            <th class="center width70">{:__('Enable')}</th>
                                            <th class="center width70">{:__('Priority')}</th>
                                            <th class="center">{:__('Description')}</th>
                                        </tr>
                                        <tr>
                                            <td class="center">{:__('Sales Price Strategy')}</td>
                                            <td class="center">
                                                <span>
                                                    <input readonly id="c-price_buy-switch" name="row[switch]" type="hidden" value="1" checked="checked">
                                                    <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
                                                        <i class="fa fa-toggle-on text-success fa-2x"></i>
                                                    </a>
                                                </span>
                                            </td>
                                            <td class="center">1</td>
                                            {foreach name="sets" item="vo" key="k"}
                                            {if condition="$vo.name=='price_buy'"}
                                            <td class="center" style="text-align: left">{$vo.explain|default=''}</td>
                                            {/if}
                                            {/foreach}
                                        </tr>
                                        {foreach name="sets" item="vo" key="k"}
                                        {if condition="$vo.name=='price_buy_last'"}
                                        <tr>
                                            <td class="center">{:__('Recent Purchase Price')}</td>
                                            <td class="center">
                                                <span>
                                                    <input id="c-price_buy_last" name="row[price_buy_last]" type="hidden" value="{$vo.is_checked}" {if condition="$vo.is_checked==1"}checked="checked"{/if}>
                                                    <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-price_buy_last" data-yes="1" data-no="0">
                                                        <i class="fa fa-toggle-on text-success fa-2x {if condition='$vo.is_checked!=1'}fa-flip-horizontal text-gray{/if}"></i>
                                                    </a>
                                                </span>
                                            </td>
                                            <td class="center">2</td>
                                            <td class="center" style="text-align: left">{$vo.explain|default=''}</td>
                                        </tr>
                                        {/if}
                                        {/foreach}
                                    </table>
                                    <button type="button" data-id="price-form" class="sub_btn btn btn-success btn-embossed">{:__('OK')}</button>
                                </form>
                            </div>
                            <div class="layui-tab-item">
                                <form id="prefix-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
                                    <input type="hidden" value="3" name="row[type]">
                                    <table class="table table-striped table-bordered table-hover table-nowrap">
                                        <tr>
                                            <th class="center">{:__('Document')}</th><th class="center">{:__('Document Prefix')}</th><th>{:__('Year')}</th><th>{:__('Month')}</th><th>{:__('Day')}</th><th>{:__('Hour')}</th><th>{:__('Minute')}</th><th>{:__('Second')}</th><th>{:__('Starting Number')}</th><th>{:__('Custom Number Length')}</th><th>{:__('Example')}</th>
                                        </tr>
                                        {foreach name="prefix" item="vo" key="k"}
                                        <tr>
                                            <td class="textLeft">{$vo.name}:</td>
                                            <td>
                                                <input class="id" type="hidden" value="{$vo.id}" name="row[id][]">
                                                <input class="prefix{$vo.id} dome" type="text" name="row[prefix{$vo.id}]" value="{$vo.prefix}">
                                            </td>
                                            <td class="center">
                                                <input class="year{$vo.id} dome" type="checkbox" name="row[year{$vo.id}]" value="1" {if condition="$vo.year==1"}checked{/if}>
                                            </td>
                                            <td class="center">
                                                <input class="month{$vo.id} dome" type="checkbox" name="row[month{$vo.id}]" value="1" {if condition="$vo.month==1"}checked{/if}>
                                            </td>
                                            <td class="center">
                                                <input class="day{$vo.id} dome" type="checkbox" name="row[day{$vo.id}]" value="1" {if condition="$vo.day==1"}checked{/if}>
                                            </td>
                                            <td class="center">
                                                <input class="hour{$vo.id} dome" type="checkbox" name="row[hour{$vo.id}]" value="1" {if condition="$vo.hour==1"}checked{/if}>
                                            </td>
                                            <td class="center">
                                                <input class="minute{$vo.id} dome" type="checkbox" name="row[minute{$vo.id}]" value="1" {if condition="$vo.minute==1"}checked{/if}>
                                            </td>
                                            <td class="center">
                                                <input class="second{$vo.id} dome" type="checkbox" name="row[second{$vo.id}]" value="1" {if condition="$vo.second==1"}checked{/if}>
                                            </td>
                                            <td>
                                                <input class="start{$vo.id} dome" type="number" name="row[start{$vo.id}]" value="{$vo.start}">
                                            </td>
                                            <td>
                                                <input class="strlen{$vo.id} dome" type="number" name="row[strlen{$vo.id}]" value="{$vo.strlen}">
                                            </td>
                                            <td>
                                                <input class="example{$vo.id} dome" readonly type="text" name="row[example{$vo.id}]" value="{$vo.example}">
                                            </td>
                                        </tr>
                                        {/foreach}
                                    </table>
                                    <button type="button" data-id="prefix-form" class="sub_btn btn btn-success btn-embossed">{:__('OK')}</button>
                                </form>
                            </div>
                            <div class="layui-tab-item">
                                <form id="xcx-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" style="max-width: 800px;">
                                    {foreach name="sets" item="vo" key="k"}
                                    {if condition="$vo.type==4"}
                                    <div class="form-group">
                                        <label class="control-label col-xs-12 col-sm-6">{$vo.nickname}：</label>
                                        <div class="col-xs-12 col-sm-6">
                                            {if condition="$vo.is_edit<1"}<input type="hidden" value="{$vo.id}" name="row[{$k}][id]">{/if}
                                            <input id="c-{$vo.name}" class="form-control" {if condition="$vo.is_edit<1"}name="row[{$k}][value]"{else/}disabled{/if} value="{$vo.value}" type="text" placeholder="{$vo.nickname}">
                                            {if condition="!empty($vo.notice)"}<tips>{$vo.notice}</tips>{/if}
                                        </div>
                                    </div>
                                    {/if}
                                    {/foreach}
                                    <div class="form-group">
                                        <label class="control-label col-xs-12 col-sm-4">{:__('User Agreement')}：</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <textarea class="form-control editor" name="agreement" rows="10">{$xcx_agreement|default=''}</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-xs-12 col-sm-4">{:__('Privacy Agreement')}：</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <textarea class="form-control editor" name="privacy" rows="10">{$xcx_privacy|default=''}</textarea>
                                        </div>
                                    </div>
                                    <button type="button" data-id="xcx-form" class="sub_btn btn btn-success btn-embossed">{:__('OK')}</button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </div>
</div>
